

-- Not finished. Don't load.
do return end


-- Namespace
	local _,mod = ...


-- Info
	local info = {
		-- Name (+realm?), level, classification
		function(unit)
			local name,realm = UnitName(unit)
			if not name then
				name = unit
			end
			if realm then
				name = name..' - '..realm
			end
			
			local level = UnitLevel(unit)
			if not level or level == -1 then
				level = '??'
			end
			local clas = UnitClassification(unit)
			clas = (
				clas == 'elite' and '+' or
				clas == 'rare' and 'rare' or
				clas == 'rareelite' and '+ rare' or
				clas == 'worldboss' and 'boss' or
				''
			)
			level = level..'|cffffffff'..clas..'|r'
			
			return name,level
		end,
		
		-- Title
		function(unit,isplayer)
			if not isplayer then return end
			
			local title = UnitPVPName(unit)
			if not title then return end
			
			title = title:gsub(UnitName(unit)..',?',''):trim()
			
			if title ~= '' then
				return ' "'..title..'"'
			end
		end,
		
		-- Guild, rank
		function(unit,isplayer)
			if not isplayer then return end
			
			local guild = GetGuildInfo(unit)
			if guild and guild ~= '' then
				return ' <'..guild..'>'
			end
		end,
		
		-- Class, race, space
		function(unit,isplayer)
			
		end,
		
	}


-- Hook
	GameTooltip:HookScript('OnTooltipSetUnit',function(self)
		local _,unit = self:GetUnit()
		if unit and UnitExists(unit) then
			
			self:ClearLines()
			
			local isplayer = UnitIsPlayer(unit)
			
			local textL,textR,prep
			local succ
			
			for i = 1,#info do
				succ,textL,textR,prep = pcall(info[i],unit,isplayer)
				if succ then
					if textL or textR then
						if prep then
							self:AddLine(' ')
						end
						self:AddDoubleLine(textL or '',textR or '')
					end
				else
					mod.softerror(textL)
				end
			end
			
			self:Show()
			
		end
	end)
